package com.testin.filter;

import javax.servlet.Filter;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;

import com.testin.commons.Constants;
import com.testin.utils.StringUtils;

public abstract class AbstractFilter implements Filter {
	public void init(FilterConfig config) throws ServletException {
		
	}

	public void destroy() {
		
	}
	

	protected void storeReturnPath(HttpServletRequest request) {
		String returnTo = request.getRequestURI();
		String queryString = request.getQueryString();
		if (StringUtils.isNotEmpty(queryString)) {
			returnTo += "?" + queryString;
		}

		request.getSession().setAttribute(Constants.RETURN_PATH, returnTo);
	}
	

}
